/*
 * ColaSDLReader.cpp
 *
 *  Created on: Nov 14, 2011
 *      Author: gonzalo
 */

#include "ColaSDLReader.h"

ColaSDLReader::ColaSDLReader(ConditionVariable* inform,ColaMensajesSDL* colaALeer,ThreadSafeList* aLlenar,TypeNotifier tipoRetorno) {
	this->aLlenar = aLlenar;
	this->aLeer = colaALeer;
	this->running = true;
	this->tipoMensaje = tipoRetorno;
	this->inform = inform;

}

void *ColaSDLReader::run(){

	while(running){
		void* leido = aLeer->getEvent();
		if (leido) {
			aLlenar->insert(std::pair<void*, TypeNotifier>(leido, tipoMensaje));
			inform->signal();
		}
	}

	return NULL;
}
ColaSDLReader::~ColaSDLReader() {
}

void ColaSDLReader::terminar(){
	this->running = false;
}
